from flask import request
from flask_classy import FlaskView, route

from ..schema.resp import query_schema, metadata_list_schema
from ..services.metadata import MetadataService
from auth.services.session import SessionService

class MetadataView(FlaskView):
    @route('/')
    def get_list(self):
        type = request.args.get('type')
        metadata_list = MetadataService.get_metadata_by_type(type)
        return query_schema.jsonify_with(
            items=metadata_list_schema.dump(metadata_list).data
        )
    @route('/t')
    def t(self):
       t = SessionService.get_token('8F9xq476lw6Y1mNXtFJJqLJnQZYgiG')
       print(t)
       return t
